The Goat's Ears of the Emperor Trojan is a Serbian fairy tale. Andrew Lang included it in The Violet Fairy Book.
The incident appears as part of the legends of Midas in classical times, but not all of the legend appears in the fairy tale.
The emperor Trojan had goat's ears, but kept this fact a secret from the populace. Every day, he had a new barber whom he would ask if he noticed anything strange; when the man answered that he had goat's ears, he was put to death. One day, an apprentice went, and said that he saw nothing strange, so he remained as the emperor's barber. The apprentice found his secret troubling him. His master advised him to tell him, the master, or his pastor, or to whisper it into a hole in the ground.
The apprentice dug a hole, whispered into it that the emperor had goat's ears, and filled it up again. An elder tree grew there, someone cut a branch and made a flute, but the only thing the flute would play was "The Emperor Trojan has goat's ears."
The news spread, and the emperor discovered it and wormed the secret out of the apprentice. He had the last branch cut and found the flute made from it was the same. He spared the apprentice's life but did not keep him on as his barber.